package com.example.mobiledatapackage.config;

import com.example.mobiledatapackage.domain.Package;
import com.example.mobiledatapackage.mapper.PackageMapper;
import com.example.mobiledatapackage.ontology.RdfConvertor;
import com.example.mobiledatapackage.service.AppSeriesService;
import org.apache.jena.rdf.model.Model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class RawModelBean {

    @Autowired
    private PackageMapper packageMapper;

    @Autowired
    private AppSeriesService appSeriesService;

    @Autowired
    private RdfConvertor rdfConvertor;

    @Value("${owl.prefix}")
    private String owlNs;

    @Bean(name = "rawModel")
    public Model getRawModel() {
        // List<Package> packages = packageMapper.selectAll();
        Model rawModel = rdfConvertor.convertPackages(new ArrayList<>());
        // rdfConvertor.convertAppSeries(appSeriesService.selectAll(), rawModel);
        rawModel.setNsPrefix("md", owlNs);
        return rawModel;
    }
}
